﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

using Fuse8.DomainFramework.Domain;

namespace Fuse8.ContentManagementFramework.SystemFacade.Workflow
{
    public interface ICmsWorkflowStateMachine<TEntity, TKey> : IDisposable
        where TEntity : class, IEntityObject<TKey>
        where TKey : IComparable<TKey>, IEquatable<TKey>
    {
        CmsWorkflowState InitialWorkflowState { get; }

        CmsWorkflowState CurrentWorkflowState { get; }

        IEnumerable<CmsWorkflowState> AllWorkflowStates { get; }

        ReadOnlyCollection<CmsWorkflowStateTransition> AvailableTransitions { get; }

        void Create(DateTime? approvalDeadline, DateTime? reviewDeadline);
        
        void Start(TEntity entity);

        void Stop();

        void MakeTransition(CmsWorkflowStateTransition transition, string notes, int? assignedUserId = null);

        void Withdraw();
    }
}
